<template>
    <div class="all_view">
        <Data_show_mode_cp
            :data_list="data_list">
            <template #left>
                全部
            </template>
        </Data_show_mode_cp>
    </div>
</template>

<script>
import Data_show_mode_cp from '@/components/public_cp/data_show_mode'
export default {  //全部文件视图
    name: 'All_view',
    components:{Data_show_mode_cp},
    data(){
        return{
            data_list:[],
        };
    },
    created(){
        this.get_data();
    },
    watch:{
        '$store.state.update_data'(){ //监听全局更新的状态来决定是否更新文件列表
            this.get_data();
        },
    },
    methods:{
        get_data(){ //从后端获取全部文件列表
            this.$store.commit('set_loading',{
                state:true,
            });
            this.$axios.json_post('/file/findList').then(({data})=>{
                this.data_list = data;
            }).finally(()=>{
                this.$store.commit('set_loading',{
                    state:false,
                });
            }).catch(msg=>{
                this.data_list = [];
                console.log(msg);
            });
        },
    },
}
</script>

<style scoped lang='scss'>
.all_view{
    width: 100%;
    padding: 0 25px;
    box-sizing: border-box;
}
</style>
